package com.heatup.apt.common.util.Netty;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

import java.util.List;

/**
 * Created by blank on 2017/11/16 下午5:32
 */
public class ToIntegerDecoder extends ByteToMessageDecoder{
    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteIn, List<Object> list) throws Exception {
        if (byteIn.readableBytes() >= 4) {
            list.add(byteIn.readInt());
        }
    }

}
